1445B - Elimination - CodeForces Solution


greedy math *900

Please click on ads to support us..

Python Code:

for _ in [0]*int(input()):
 a,b,c,d=map(int,input().split())
 print(max(a+b,c+d))

C++ Code:

#include<bits/stdc++.h>
#include<algorithm>
#include<vector>
#include<string>
#include<cmath>
#include<iomanip>
#include<map>

/**--------------------------------**/


#define ll long long int
#define ld long double
#define ull unsigned long long int
#define pb push_back
#define pf push_front
#define en cout<<endl;
#define yes cout<<"YES"<<endl;
#define no  cout<<"NO"<<endl;
#define no1 {cout<<-1<<endl; r0}
#define no0 {cout<<0<<endl; r0}
#define yes_r { cout<<"YES"<<endl; return ; }
#define no_r { cout<<"NO"<<endl; return ; }
#define r0 return ;
#define fr first
#define sc second
#define TT ll tt;cin>>tt;while(tt--)
#define No cout << "No" << endl ;



/**-------------------------------**/

using namespace std ;

int fact(long double n )
{
    if(n == 0)
    {
        return 1;

    }
    return  n * fact(n - 1) ;
}

/**-------------------------------**/

int cnk(int n, int k)
{
    return fact(n) / (fact(k) * fact(n - k)) ;
}

/**------------------------------**/

bool even(int n)
{
    if(n%2!=0)
        return false ;

    return true ;
}

/**------------------------------**/

int fib(int n)
{
    if(n<2)
        return n ;
    else
        return (fib(n - 1) + fib(n - 2)) ;

}

/**--------------------------------**/


/**--------------------------------**/

bool all_same(string s)
{
    for(int i=0; i<s.size(); i++)
        if(s[i]!=s[0])
            return false ;

    return true ;
}

/**---------------------------------**/

bool odd(int a)
{
    if(a%2==0)
        return false ;

    return true ;
}

void softclub()
{
}


int main()
{
    ios_base::sync_with_stdio(0) ;
    cin.tie(0) ;
    cout.tie(0) ;
    TT
    {
        ll a , b , x , y ;
        cin >> a >> b >> x >> y ;
        cout << max(a + b , x + y)  << endl ;
    }









}



 	   	 		   	  			 		 	   	


Comments

Submit
0 Comments
More Questions

148B - Escape
847G - University Classes
1110A - Parity
1215B - The Number of Products
604C - Alternative Thinking
1204C - Anna Svyatoslav and Maps
322A - Ciel and Dancing
1689B - Mystic Permutation
1711B - Party
1702D - Not a Cheap String
1714F - Build a Tree and That Is It
1703F - Yet Another Problem About Pairs Satisfying an Inequality
610A - Pasha and Stick
1200A - Hotelier
1091A - New Year and the Christmas Ornament
1352B - Same Parity Summands
1102A - Integer Sequence Dividing
630B - Moore's Law
1004A - Sonya and Hotels
1680B - Robots
1690A - Print a Pedestal (Codeforces logo)
1295A - Display The Number
1077A - Frog Jumping
1714G - Path Prefixes
1369C - RationalLee
289B - Polo the Penguin and Matrix
1716A - 2-3 Moves
1670B - Dorms War
1716B - Permutation Chain
987A - Infinity Gauntlet